import re
import shutil

import requests
import os



# root = 'static/高清壁纸'
# if os.path.exists(root):
#     shutil.rmtree(root)
# os.mkdir(root)

# url = "https://www.hdbz.net/wallpaper/"

# request_response =  requests.get(url).content.decode()
#
# items = re.findall(r'<a href="(/wallpaper/\d{6}/\d{6}.html)" target="_blank" title="(.*?)" .*?data-original="(.*?)" .*? class="lazy" />', request_response, re.S)
#
# print(len(items))
# for item in items:
#     detail_url = f'https://www.hdbz.net{item[0]}'
#     title = item[1]
#     img_url = item[2]
#     img_response = requests.get(img_url)
#     print(img_url)
#
#     with open(f'{root}/{title}.jpg', 'wb') as f:
#         f.write(img_response.content)

favorite_url = 'https://vip.hdbz.net/auth/login.htm'
favorite_response = requests.post(favorite_url, data={'username': 19561983101, 'userpwd': 'Dby123456'})


